using System;
using System.Collections.Generic;
using System.Text;
using BoOnce.Components;
using BoOnce.Core.Components;

namespace BoOnce.GameLogic
{
    /// <summary>
    /// A combo is an ordered list of button
    /// </summary>
    class Combo
    {
        #region Attributes
        private LinkedList<InputComponent.Buttons> _Combo;
        private Action _AssociatedAction;
        #endregion

        #region Properties
        public Action AssociatedAction { get { return _AssociatedAction; } }
        public LinkedList<InputComponent.Buttons> Description { get { return _Combo; } }
        #endregion

        #region Constructors
        public Combo(Action associtedAction, LinkedList<InputComponent.Buttons> c)
        {
            _AssociatedAction = associtedAction;
            _Combo = c;
        }

        public Combo(Action associtedAction, params InputComponent.Buttons[] list)
        {
            _AssociatedAction = associtedAction;
            _Combo = new LinkedList<InputComponent.Buttons>();
            foreach (InputComponent.Buttons button in list)
            {
                _Combo.AddLast(button);
            }
        }
        #endregion

        public override String ToString()
        {
            String c = "";
            foreach (InputComponent.Buttons button in _Combo) c += ";" + button;

            return c + "=>" + _AssociatedAction.ToString();
        }
    }
}
